import React, { useCallback, useEffect, useContext, useState } from 'react'
import Search from '@/components/search/Search'
import Navbar from '@/components/Navbar/Navbar'
import left from '@/assets/images/left.png'
import Leftnav from '@/components/LeftNav/Leftnav'
import { AllWrapper } from './styledAll'
import Catelist from '@/components/cate/Catelist'
import { useHistory } from 'react-router-dom'
import httpContext from '@/context/httpContext'
import Brand from './Brand'
import Theme from './Theme'
export default function All(props) {
    // const list = props.obj.list
    const history = useHistory()
    const { get } = useContext(httpContext)
    const [tablist, setTabList] = useState([])
    // console.log(props.obj.theme);
    const handleClick = useCallback(
        () => {
            history.goBack()
        }
    )
    const handleSearchClick=useCallback(
        ()=>{
            history.push('/search')
        }
    )
    // useEffect(
    //     async () => {
    //         let res = await get({
    //             url: '/api/all'
    //         })
    //         setTabList(res.data.data.list)
    //     }, []
    // )
    // console.log(tablist);
    return (
        <AllWrapper>
            <Navbar
                title='分类'
                icon={left}
                color='#F8F8F8'
                onClick={handleClick}
            >
            </Navbar>
            <Search
                borderColor="#eee"
                borderRadius={10}
                outerBg='white'
                innerBg='#F5F5F9'
                title='搜索商品'
                height='.3rem'
                onClick={handleSearchClick}
            ></Search>
            {/* <Leftnav></Leftnav> */}
          
            <Leftnav
                textColor='green'
                innerBg='pink'
                activeInnerBg='white'
            >
                
                <Leftnav.Item title='推荐'>
                    <Catelist list={props.obj.list}></Catelist>
                </Leftnav.Item>
                <Leftnav.Item title='品牌'><Brand></Brand></Leftnav.Item>
                <Leftnav.Item title='主题'> <Theme theme={props.obj.theme}></Theme></Leftnav.Item>
                <Leftnav.Item title='系列'><Catelist list={props.obj.series}></Catelist></Leftnav.Item>
                <Leftnav.Item title='潮鞋'></Leftnav.Item>
                <Leftnav.Item title='潮服'></Leftnav.Item>
                <Leftnav.Item title='箱包'></Leftnav.Item>
                <Leftnav.Item title='美妆'></Leftnav.Item>
                <Leftnav.Item title='配饰'></Leftnav.Item>
                <Leftnav.Item title='手表'></Leftnav.Item>
                <Leftnav.Item title='数码'></Leftnav.Item>
                <Leftnav.Item title='女装'></Leftnav.Item>
                <Leftnav.Item title='潮玩'></Leftnav.Item>
                <Leftnav.Item title='运动'></Leftnav.Item>
                <Leftnav.Item title='家居'></Leftnav.Item>
                <Leftnav.Item title='家电'></Leftnav.Item>
                <Leftnav.Item title='汽车'></Leftnav.Item>
                <Leftnav.Item title='艺术'></Leftnav.Item>
            </Leftnav>
        </AllWrapper>
    )
}
